knitr::opts_chunk$set(echo=TRUE)
library(plotly)
In this document, R’s graphing library plotly is explored. The iris data set is used.
if(!require(iris))
install.packages("iris",repos='http://cran.us.r-project.org')
In this section, we will use plot_ly to graph sepal length against petal length. The color scheme is based on the flower species
plot_ly(data=iris,x=iris$Sepal.Length,y=iris$Petal.Length,mode="markers",color=iris$Species) %>%
layout(title="Mapping Sepal Length vs Petal Length",xaxis=list(title="Sepal Length"),yaxis=list(title="Petal Length"))